package com.zhiyizhen.handheld.component.pharmacy.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.zhiyizhen.handheld.common.view.adapter.recyclerview.BaseAdapter;
import com.zhiyizhen.handheld.common.view.adapter.recyclerview.BaseViewHolder;
import com.zhiyizhen.handheld.component.pharmacy.bean.DetailListBean;
import com.zhiyizhen.handheld.databinding.ItemRegimenRecordOtherDetailBinding;

public class RegimenRecordOtherInfoAdapter extends BaseAdapter<DetailListBean, RegimenRecordOtherInfoAdapter.ShuyeGroupViewHolder> {

    public RegimenRecordOtherInfoAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ShuyeGroupViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ShuyeGroupViewHolder(this, ItemRegimenRecordOtherDetailBinding.inflate(LayoutInflater.from(parent.getContext())));
    }

    class ShuyeGroupViewHolder extends BaseViewHolder<DetailListBean> {

        private final ItemRegimenRecordOtherDetailBinding binding;

        public ShuyeGroupViewHolder(BaseAdapter<DetailListBean, ShuyeGroupViewHolder> adapter, ItemRegimenRecordOtherDetailBinding viewBinding) {
            super(adapter, viewBinding.getRoot());
            binding = viewBinding;
        }

        @Override
        public void bindData(DetailListBean data) {

            binding.typeTv.setText(data.getDrugName());
            binding.acupointNameTv.setText(data.getDosage() + data.getTotalOutQtyUnitText());

//            binding.contentLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
        }
    }

}